<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>购货入库 - 物流管理系统</title>
	<style media="all" type="text/css">
		@import "style/all.css";
		@import "style/jquery/ui.all.css";
	</style>
	<script type="text/javascript" src="script/jquery-1.3.2.min.js"></script>
	<script type="text/javascript" src="script/jquery-ui-personalized-1.6rc6.min.js"></script>
	<script type="text/javascript" src="script/date.js"></script>
	<script type="text/javascript" src='script/common.js'></script>
	<script type="text/javascript">
		  $(function(){
				datepicker('.date-three');
		  });

		 function checkIn(){
		      var numIn=document.getElementById("num_in").value;
			  if(numIn=="" || numIn==null){
				 alert("实际入库数量不能为空");
				 return false;
			  }
			  else if(numIn==0){
				 alert("实际入库数量不能0");
				 return false;
			  
			  }
			  else if(isNaN(numIn)){
			     alert("实际入库数量不是数字");
				 return false;
			  }
				 window.location='in_goods.jsp';
				 return true;
		 }
         function checkTime(){
		     var time=document.getElementById("time_in").value;
			 if(time=="" || time==null){
			    alert("请选择实际入库日期!");
			    return false;
			 }
			
		     return true;			
		 }
         function checkSelect(id){
        	 var num=document.getElementById("num_in").value;
        	 var time=document.getElementById("time_in").value;
        	 var remark=document.getElementById("remark").value;
			 if(checkIn()){
			    if( checkTime()){
				   alert('入库成功!');
				   window.location.href='update/'+id+'/'+num+'/'+time+'/'+remark;
				   return true;	
				}	
				return false;
			 }		 
			 return false;
		 }
	</script>
</head>
<body style="background: none">
     <c:forEach items="${list }" var="list">
	<div class="top-bar">
		<!--a href="#" class="button">取 消</a><a href="#" class="button">保 存</a-->
		<h1>购货入库</h1>
		<div class="breadcrumbs">
			<div class="button-bar">
				<input type="button" name="help" value="帮助" class="button"  onclick="help('物流管理系统')"/>
				<input type="button" name="select" value="入库" onclick="checkSelect(${list.id })" class="button"/>
				<input type="button" name="back" value="返回" onclick="window.history.go(-1);"  class="button"/>
			</div>
			<a href="index.jsp" target="_top"  >首页</a> /
			<a href="depot_manage/index.jsp" target="_top"  >库房管理</a> 
		 </div>
	</div>
    <div class="select-bar">
	  <table class="select-table">
	  
		<tr>
			<th>购货单号</th>
			<td>${list.id }</td>
			<th>商品编号</th>
			<td>${list.productNum }</td>
		</tr>
		<tr>
			<th>商品名称</th>
			<td>${list.productName }</td>
			<th>应入库数量</th>
			<td>${list.instoreage }</td>
		</tr>
		<tr>
			<th>实际入库日期</th>
			<td style="white-space:nowrap"><input type="text" id="time_in" name="time_in" class="date-three text" readonly/><span style='color:red'>*</span></td>
			<th>实际入库数量</th>
			<td><input type="text"  value="" size='8' id="num_in" name="num_in"><span style='color:red'>*</span></td>
			
		</tr>
		<tr>
			<th>备注信息</th>
			<td colspan="3"><textarea cols='25' id="remark"></textarea></td>
		
		</tr>
		</c:forEach>
	  </table>
    </div>
</body>
</html>
